#include "SMPPSubmitMultiResp.hpp"

using namespace smpp::pdu;

SubmitMultiResp::SubmitMultiResp(const Header &nHeader,
const CoctetString &nMessageId,
const quint8 nNoUnsuccess,
const QVector<UnsuccessSME> nUnsuccessSME,
const MessageSubmissionResponseTLVs &nMessageSubmissionResponseTLVs):
Header(nHeader),
_MessageId(nMessageId),
_NoUnsuccess(nNoUnsuccess),
_UnsuccessSME(nUnsuccessSME),
MessageSubmissionResponseTLVs(nMessageSubmissionResponseTLVs){}

SubmitMultiResp::SubmitMultiResp(const SubmitMultiResp &nSubmitMultiResp):
Header(nSubmitMultiResp),
_MessageId(nSubmitMultiResp.getMessageId()),
_NoUnsuccess(nSubmitMultiResp.getNoUnsuccess()),
_UnsuccessSME(nSubmitMultiResp.getUnsuccessSME()),
MessageSubmissionResponseTLVs(nSubmitMultiResp){}

void SubmitMultiResp::setMessageId(const CoctetString &nMessageId){
	_MessageId = nMessageId;
}

const CoctetString &SubmitMultiResp::getMessageId() const{
	return _MessageId;
}

void SubmitMultiResp::setNoUnsuccess(const quint8 nNoUnsuccess){
	_NoUnsuccess = nNoUnsuccess;
}

const quint8 SubmitMultiResp::getNoUnsuccess() const{
	return _NoUnsuccess;
}

void SubmitMultiResp::addUnsuccessSME(const UnsuccessSME &nUnsuccessSME){
	_UnsuccessSME.push_back(nUnsuccessSME);
}

void SubmitMultiResp::setUnsuccessSME(
	const QVector<UnsuccessSME> &nUnsuccessSME){
	_UnsuccessSME = nUnsuccessSME;
}

const QVector<UnsuccessSME> &SubmitMultiResp::getUnsuccessSME() const{
	return _UnsuccessSME;
}

void SubmitMultiResp::calcCommandLength(){
	_CommandLength = 17 + _MessageId.size() +
		MessageSubmissionResponseTLVs::getLength();
	for(int i = 0;i<_UnsuccessSME.size();i++)
		_CommandLength += _UnsuccessSME[i].getLength();
}
